package com.hanshushi_jiekou;

public class RunableDemo {
    public static void main(String[] args) {
        // 匿名内部类调用
        startThread(new Runnable() {
            @Override
            public void run() {
                System.out.println("线程：" + Thread.currentThread().getName() + "启动了");
            }
        });

        // lambda表达式
        startThread(() -> System.out.println("线程：" + Thread.currentThread().getName() + "启动了"));
    }

    private static void startThread(Runnable r) {
        new Thread(r).start();
    }
}
